package com.song.osclient.view;

import android.content.Context;
import android.support.v4.app.FragmentTabHost;
import android.util.AttributeSet;

/**
 * Created by Administrator on 2015/10/21.
 */
public class CustomFragmentTabHost extends FragmentTabHost{
    private String noChangeTabId;
    private String currentTabId;
    public void setNoChangeTab(String tabId){
        noChangeTabId = tabId;
    }

    public CustomFragmentTabHost(Context context) {
        super(context);
    }

    public CustomFragmentTabHost(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void onTabChanged(String tabId) {
        if (noChangeTabId != null && tabId.equals(noChangeTabId)){
            setCurrentTabByTag(currentTabId);
        }else {
            currentTabId = tabId;
            super.onTabChanged(tabId);
        }
    }
}
